#!/bin/bash
# copy plugins !

cd "`dirname $0`"

if [ $1 -a -d $1 ]
then
    OUT_MEDIA=$1
else
    OUT_MEDIA="/media/LUDO-SCL"
fi

for i in `ls`
do
    if [ -f "${i}/release/${i}.sunds" ]
    then
        OUT_DIR="/data/SunOS/plugins/${i}"

        if [ ! -d ${OUT_MEDIA}${OUT_DIR} ]
        then
            echo "Creating directory : ${OUT_MEDIA}${OUT_DIR}"
            mkdir -p ${OUT_MEDIA}${OUT_DIR}
        fi

        echo -e -n "\x1b[1;32mCopying ${i}...\x1b[0m"
        cp -r ${i}/release/* ${OUT_MEDIA}${OUT_DIR}/
        echo -e "\x1b[1;32mok\x1b[0m"
    fi
done

